package com.solution.pc.order.task;

import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.solution.admin.order.service.OrderService;

/**
 * 更新订单支付状态任务
 * @author llp
 */
public class OrderPayStatusUpdateTask implements Runnable {

	private static final Logger log = LoggerFactory
			.getLogger(OrderPayStatusUpdateTask.class);
	
	private OrderService orderService;
	
	private Map<String, Object> payParams;

	public OrderPayStatusUpdateTask(Map<String, Object> payParams) {
		this.payParams = payParams;
	}

	/**
	 * 线程执行任务(更新订单支付状态)
	 */
	@Override
	public void run() {
		// 更新订单状态（插入支付记录，修改订单状态为待审核）
		int result = orderService.updateOrderStatus(payParams);
		if(result <= 0){
			log.error("订单("+payParams.get("orderCode")+")更新支付状态异常");
		}
	}

	public void setOrderService(OrderService orderService) {
		this.orderService = orderService;
	}

	public void setPayParams(Map<String, Object> payParams) {
		this.payParams = payParams;
	}
	

}
